package com.vegetable.modules.entity.outbound;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.vegetable.modules.entity.inbound.OrderCost;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 销售出库单
 * </p>
 *
 * @author wangruijie
 * @since 2024-04-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="AllocationOut对象", description="调拨出库单")
public class AllocationOut implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键id")
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "生产者ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long producerId;

    @ApiModelProperty(value = "销售订货id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long orderId;

    @ApiModelProperty(value = "单据编号")
    private String docNo;

    @ApiModelProperty(value = "批次号")
    private String lotNo;

    @ApiModelProperty(value = "订单时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date orderTime;

    @ApiModelProperty(value = "订单来源0订货发货，1新建")
    private Integer orderSource;

    @ApiModelProperty(value = "状态0未出库，1已出库")
    private Integer state;

    @ApiModelProperty(value = "状态0未对冲，1已对冲")
    private Integer hedgingState;

    @ApiModelProperty(value = "商户ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long customerId;

    @ApiModelProperty(value = "商户名称")
    private String customerName;

    @ApiModelProperty(value = "车辆ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long carId;

    @ApiModelProperty(value = "司机")
    private String carDriver;

    @ApiModelProperty(value = "车辆名称")
    private String carName;

    @ApiModelProperty(value = "销售金额")
    private BigDecimal money = BigDecimal.ZERO;


    @ApiModelProperty(value = "成本")
    private BigDecimal cost;

    @ApiModelProperty(value = "数量")
    private Integer number;

    @ApiModelProperty(value = "重量")
    private BigDecimal weight;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "创建者ID")
    private Long createUserId;

    @ApiModelProperty(value = "创建时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date createTime;

    @ApiModelProperty(value = "商品明细")
    @TableField(exist = false)
    private List<AllocationOutDetail> commodities;

    @ApiModelProperty(value = "其他费用")
    @TableField(exist = false)
    private List<OrderCost> costs;


    @ApiModelProperty(value = "调入仓库名称")
    private String inWarehouseName;

    @ApiModelProperty(value = "调出仓库名称")
    private String outWarehouseName;

}
